package edu.zut.cs.software.example.service;

import java.awt.print.Pageable;
import java.io.Serializable;

import org.springframework.data.domain.Page;

import edu.zut.cs.software.example.domain.BaseEntity;




/**
 * @author Administrator
 *
 * @param <PK>
 * @param <T>
 */
public interface GenericManager<PK extends Serializable, T extends BaseEntity<PK>>{

	/**
	 * * delete entity according given id
	 *
	 * @param id
	 */
	public void delete(PK id);

	public void deleteAll();

	/**
	 * fetch all entities
	 *
	 * @return list for all entities
	 */
	public Iterable<T> findAll();

	/**
	 * @param page
	 * @return
	 */
	public Page<T> findAll(Pageable page);

	/**
	 * fetch specified entity according id;
	 *
	 * @param id entity id;
	 * @return entity
	 */
	public T findById(PK id);

	/**
	 * @param entities
	 * @return
	 */
	public Iterable<T> save(Iterable<T> entities);

	/**
	 * save specified entity;
	 *
	 * @param entity entity for saving
	 * @return saved domain entity
	 */
	public T save(T entity);

	public long count();
	
	
}
